package org.flexlancer.databases
{
	public class ResetBillItems
	{
		public static const TABLE:String = "resetbillitems";
		
		public static function Add(billref:Number,
				itemcode:Number,
				qty:Number,
				price:Number,
				total:Number,
				title:String,
				cat:String):void{
			try{
				var insertObj:Object = new Object();
				insertObj.billrefid = billref;
				insertObj.itemcode = itemcode;
				insertObj.itemcat = cat;
				insertObj.price = price;
				insertObj.quantity = qty;
				insertObj.total = total;
				insertObj.title = title;
				DatabaseManager.Manager.Insert(TABLE,insertObj);
			}catch(err:Error){
				throw err;
			}
		}

		public static function AddObject(parmObject:Object):void{
			try{
				var insertObj:Object = parmObject;
				delete insertObj.itemsid;
				DatabaseManager.Manager.Insert(TABLE,insertObj);
			}catch(err:Error){
				throw err;
			}
		}

		public static function List(condition:String = ""):Array{
			try{
				return DatabaseManager.Manager.Select(TABLE,null,condition);
			}catch(err:Error){
				throw err;
			}
			return new Array;
		}
	}
}